package com.cls.system.mapper;

import com.cls.common.annotation.EncryptParam;
import com.cls.system.entity.Expert;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 专家表 Mapper
 *
 * @author Carey
 * @date 2020-11-06 10:47:30
 */
public interface ExpertMapper extends BaseMapper<Expert> {

    List<Expert> findExpertDetail(@Param("expert")Expert expert);

    Expert findByUserId(@Param("userId")Long userId);
    @Select("select count(0) from biz_expert where is_delete = 0 and mobile=#{mobile} ")
    Integer findByMobile(@EncryptParam("mobile") @Param("mobile")String mobile);
    @Select("select count(0) from biz_expert where is_delete = 0 and identity_id=#{identityId} ")
    Integer findByIdCard(@EncryptParam("identityId") @Param("identityId")String identityId);

    @Select("select * from biz_expert where expert_id in( " +
            "SELECT DISTINCT expert_id FROM biz_review WHERE plan_id=#{planId} AND is_delete=0 )")
    List<Expert> selectReviewExpertByPlanId(@Param("planId") Long planId);
}
